#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <error.h>
#include <unistd.h>
#include <string>
using namespace std;

int main()
{

    const char *file = "./myCp";
    int flag = access(file, F_OK);

    if (flag == 0)
    {
        cout << "文件存在" << endl;
    }
    else
    {
        cout << "文件不存在" << endl;
    }
    
    flag = access(file, X_OK);
    if (flag == 0)
    {
        cout << "文件具备执行权限" << endl;
    }
    else
    {
        cout << "文件不具备执行权限" << endl;
    }

    return 0;
}